Disallow nesting of packages with same packge_id
authorSeth Falcon <seth@chef.io>
Fri, 3 Jul 2015 22:36:25 +0000 (15:36 -0700)
committerSeth Falcon <seth@chef.io>
Fri, 3 Jul 2015 22:36:25 +0000 (15:36 -0700)
commitcdbaa7493e29a9167766f4d6129a5042a6cabcf3
tree2399ceab39f1765f3af832e8954a3b1b804fd37c
parent78088b5cac591a98a7c36c0760cdb23e46c075b1
Disallow nesting of packages with same packge_id

If a package contains a subdirectory that contains a copy of
itself (strange, but encountered in the wild in the context of an OS
package build tool), cargo was failing with a non-descriptive "An
unknown error occurred" (or "no package found in source" with
--verbose).

Since nested packages use the root path, such a package will have an
identical package_id to the root package. With this patch, we keep the
first occurance of a given package_id rather than overwritting --
effectively ignoring the nested package with duplicated name. A warn!
message is printed.
src/cargo/ops/cargo_read_manifest.rs